//
//  LogManager.m
//  HandPay
//
//  Created by xy on 10-6-13.
//  Copyright 2010 HANDPAY. All rights reserved.
//

#import "LogManager.h"

int CanLogOutput(){
#if DEBUG
    return 1;
#else
    return 0;
#endif
}


@implementation LogManager

+(void)OutPut:(NSString *)info{
#if DEBUG
    NSLog(@"%@",info);
#endif
}

+ (void) file:(char*)sourceFile function:(char*)functionName lineNumber:(int)lineNumber format:(NSString*)format, ... {
	NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
	va_list ap;
	NSString *print, *file, *function;
	va_start(ap, format);
	file = [[NSString alloc] initWithBytes:sourceFile length:strlen(sourceFile) encoding:NSUTF8StringEncoding];
	
	function = [NSString stringWithCString:functionName encoding:NSUTF8StringEncoding];
	print = [[NSString alloc] initWithFormat:format arguments:ap];
	va_end(ap);
	NSLog(@"%@:%d %@; \n%@", [file lastPathComponent], lineNumber, function, print);
	[print release];
	[file release];
	[pool release];
}

@end
